#ifndef VECTOR_T_H
#define VECTOR_T_H

#include <stdio.h>
#include "units.h"


#define VECTOR_T_DATA STroup


typedef struct VECTOR_T {
	size_t capacity;
	int current;
	VECTOR_T_DATA * data;
} VECTOR_T;


// Creates a new vecteur and returns a pointer to it.
VECTOR_T * v_new(size_t capacity);

// Adds a new element to the vector. Automatically resizes the vector if needed.
void v_add(VECTOR_T * vector, VECTOR_T_DATA data);

// Changes the value at specified position with new value.
void v_set(VECTOR_T * vector, VECTOR_T_DATA data, int pos);

// Gets the element at specified position in the vector. Index starts at 0.
VECTOR_T_DATA v_get(VECTOR_T * vector, int pos);

// Removes the last element in the vector and returns it's value.
VECTOR_T_DATA v_pop(VECTOR_T * vector);

// Removes the element at specified position in the vector and returns it's value. This could be slow.
// Index starts at 0.
VECTOR_T_DATA v_remove(VECTOR_T * vector, int pos);

// Returns current count of elements stored in the vector.
int v_count(VECTOR_T * vector);

// Returns true if the vector is empty, false otherwise.
int v_isempty(VECTOR_T * vector);

// Logically erases the data in the vector.
void v_clear(VECTOR_T * vector);

// Deletes the vector and frees the allocated memory.
void v_delete(VECTOR_T * vector);

#endif//->VECTOR_T_H
